export default {
	carts: (state) => state.cart.list,
	goodsCount: (state) => state.cart.list.reduce((acc,cur)=>acc+cur.goods_count, 0),
	selectedCarts: (state) => {
		return state.cart.list.filter(item => item.goods_checked)
	},
	totalMoney(state, getters) {
		return getters.selectedCarts.reduce((acc, cur) => acc+cur.goods_price*cur.goods_count, 0)
	},
	isSelAll(state){
		return {
			
			get() {
				return state.cart.list.every(item => item.goods_checked)
			},
			set(val) {
				state.cart.list.forEach(item => item.goods_checked = val)
			}
		}
	}
}